It looks like my solution to the "ModuleProperties" problem was not in fact solved here: |
Re: GetModProps issues Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: GetModProps issues Mathias Mamsch - Thu Jan 10 07:55:40 EST 2013 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
I'm guessing these times correlate to the time it takes to do a GUI manual "Module Properties", for our Huge modules takes several minutes. -Louie |
Re: GetModProps issues llandale - Thu Jan 10 10:33:54 EST 2013
I'm guessing these times correlate to the time it takes to do a GUI manual "Module Properties", for our Huge modules takes several minutes. -Louie Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: GetModProps issues Mathias Mamsch - Fri Jan 11 04:56:43 EST 2013 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: GetModProps issues I re-wrote it. Constructive criticism is encouraged, including in the comments:
Date fDateOf(string in_sDate)
{ Date dat = in_sDate
return(dat)
}
/* fModProps_ Get Module-level attribute values without opening the module
This uses the new DOORS v9 notion of "ModuleProperties".
However, getting the ModuleProperties of large modules inexplicably takes almost as much
time as it takes to open the module in the first place. Getting the attr value
of more than one such attr makes the whole notion useless.
The culprit is getting the ModuleProperties handle using getProperties().
This set of functions gets all the module-level attributes for a module when any
is requested, and any subsequent retrieval by-passes the ModuleProperties and
takes negligible time.
If the user requests the value of some other module, this module's values are no longer remembered.
Thus, time is saved presuming that the calling script gets all the relevant values from a single module
before moving on to the next module.
*/
string g_fModProps_NameModule = "" // FullName of module associated with the following Skip
Skip g_fModProps_skpValues = null // module-level attr values KEY: 'string' NameAttr; DATA: 'string' value
//********************************************************
Skip fModProps_GetAllValues(ModName_ in_mn)
{
Skip skpReturnValues = createString()
string ErrMess, EvalResult
string EvalCode = "
ModName_ mn = addr_ " (int (addr_ in_mn)) "
ModuleVersion mv = moduleVersion (mn)
ModuleProperties mp
AttrDef ad
string NameAttr, AttrValue
Skip skpValues = addr_ " (int (addr_ skpReturnValues)) "
int TimeStart = getTickCount_
getProperties (mv, mp)
print \"\t>>fModProps_GetAllValues, getProperties.. \" (getTickCount_ - TimeStart) \"ms\n\"
delete(mv)
if (!null mp)
{
for NameAttr in mp do
{ ad = find(mp, NameAttr)
if (null ad) continue
if (ad.dxl) continue // Attr-DXL
noError()
AttrValue = mp.NameAttr \"\"
lastError()
put(skpValues, NameAttr, AttrValue)
} // end module-level attrs
}
return_(\"\")
" // end string EvalCode
ErrMess = checkDXL(EvalCode)
if (!null ErrMess)
{ print "fModProps_GetAllValues(); checkDXL() error [" ErrMess "\t]... for code:" EvalCode "\n"
}
else
{ noError()
int TimeStart = getTickCount_
EvalResult = eval_(EvalCode)
ErrMess = lastError()
print "\t>>fModProps_GetAllValues, eval_ .. " (getTickCount_ - TimeStart) "ms\n"
if (!null ErrMess)
{ print "fModProps_GetAllValues() eval_() error [" ErrMess "\t]... for code:" EvalCode "\n"
EvalResult = ""
}
}
// print "EvalResult [" EvalResult "]\n"
return skpReturnValues
} // end fModProps_GetAllValues()
//********************************************************
string fModProps_GetValue(string in_NameModFull, string in_NameAttr)
{ // Get the module-level attribute value of the module without opening it.
// Attr-DXL values are not retrieved.
// Return null on any error such as no-such module-level attr in that module
if (null in_NameModFull or null in_NameAttr) then return("")
ModName_ mn = module(in_NameModFull)
string AttrValue
if (null mn) then return("")
int TimeStart = getTickCount_
if (g_fModProps_NameModule != in_NameModFull)
{ // First Request for this module.
// Retrieve ALL module-level attr values for this module.
if (!null g_fModProps_skpValues) then delete(g_fModProps_skpValues)
g_fModProps_skpValues = fModProps_GetAllValues(mn)
g_fModProps_NameModule = in_NameModFull
}
else{} // We already know all module-level attr values for this module
print "\t>>fModProps_GetValue, \t" (getTickCount_ - TimeStart) "ms\t" in_NameAttr "\n"
if (find(g_fModProps_skpValues, in_NameAttr, AttrValue)) //
then return(AttrValue)
else return("")
} // end fModProps_GetValue()
//-------------------------------------------------------------------
Date fModProps_GetValue(string in_NameModFull, string in_NameAttr)
{ // Overloaded, presume the value represents a Date
return(fDateOf(fModProps_GetValue(in_NameModFull, in_NameAttr)))
} // end Date fModProps_GetValue()
void DoTest(string in_NameModFull)
{
Date LastModOn = fModProps_GetValue(in_NameModFull, "Last Modified On")
string LastModBy = fModProps_GetValue(in_NameModFull, "Last Modified By")
print in_NameModFull "\t" LastModOn " \t" LastModBy "\n"
}
// Select a couple modules in the DOORS Explorer:
Skip skpSelected = getSelectedItems()
Item itm
for itm in skpSelected do
{ DoTest(fullName(itm))
}
delete(skpSelected)
|
Re: GetModProps issues llandale - Sat Jan 12 14:36:29 EST 2013 I re-wrote it. Constructive criticism is encouraged, including in the comments:
Date fDateOf(string in_sDate)
{ Date dat = in_sDate
return(dat)
}
/* fModProps_ Get Module-level attribute values without opening the module
This uses the new DOORS v9 notion of "ModuleProperties".
However, getting the ModuleProperties of large modules inexplicably takes almost as much
time as it takes to open the module in the first place. Getting the attr value
of more than one such attr makes the whole notion useless.
The culprit is getting the ModuleProperties handle using getProperties().
This set of functions gets all the module-level attributes for a module when any
is requested, and any subsequent retrieval by-passes the ModuleProperties and
takes negligible time.
If the user requests the value of some other module, this module's values are no longer remembered.
Thus, time is saved presuming that the calling script gets all the relevant values from a single module
before moving on to the next module.
*/
string g_fModProps_NameModule = "" // FullName of module associated with the following Skip
Skip g_fModProps_skpValues = null // module-level attr values KEY: 'string' NameAttr; DATA: 'string' value
//********************************************************
Skip fModProps_GetAllValues(ModName_ in_mn)
{
Skip skpReturnValues = createString()
string ErrMess, EvalResult
string EvalCode = "
ModName_ mn = addr_ " (int (addr_ in_mn)) "
ModuleVersion mv = moduleVersion (mn)
ModuleProperties mp
AttrDef ad
string NameAttr, AttrValue
Skip skpValues = addr_ " (int (addr_ skpReturnValues)) "
int TimeStart = getTickCount_
getProperties (mv, mp)
print \"\t>>fModProps_GetAllValues, getProperties.. \" (getTickCount_ - TimeStart) \"ms\n\"
delete(mv)
if (!null mp)
{
for NameAttr in mp do
{ ad = find(mp, NameAttr)
if (null ad) continue
if (ad.dxl) continue // Attr-DXL
noError()
AttrValue = mp.NameAttr \"\"
lastError()
put(skpValues, NameAttr, AttrValue)
} // end module-level attrs
}
return_(\"\")
" // end string EvalCode
ErrMess = checkDXL(EvalCode)
if (!null ErrMess)
{ print "fModProps_GetAllValues(); checkDXL() error [" ErrMess "\t]... for code:" EvalCode "\n"
}
else
{ noError()
int TimeStart = getTickCount_
EvalResult = eval_(EvalCode)
ErrMess = lastError()
print "\t>>fModProps_GetAllValues, eval_ .. " (getTickCount_ - TimeStart) "ms\n"
if (!null ErrMess)
{ print "fModProps_GetAllValues() eval_() error [" ErrMess "\t]... for code:" EvalCode "\n"
EvalResult = ""
}
}
// print "EvalResult [" EvalResult "]\n"
return skpReturnValues
} // end fModProps_GetAllValues()
//********************************************************
string fModProps_GetValue(string in_NameModFull, string in_NameAttr)
{ // Get the module-level attribute value of the module without opening it.
// Attr-DXL values are not retrieved.
// Return null on any error such as no-such module-level attr in that module
if (null in_NameModFull or null in_NameAttr) then return("")
ModName_ mn = module(in_NameModFull)
string AttrValue
if (null mn) then return("")
int TimeStart = getTickCount_
if (g_fModProps_NameModule != in_NameModFull)
{ // First Request for this module.
// Retrieve ALL module-level attr values for this module.
if (!null g_fModProps_skpValues) then delete(g_fModProps_skpValues)
g_fModProps_skpValues = fModProps_GetAllValues(mn)
g_fModProps_NameModule = in_NameModFull
}
else{} // We already know all module-level attr values for this module
print "\t>>fModProps_GetValue, \t" (getTickCount_ - TimeStart) "ms\t" in_NameAttr "\n"
if (find(g_fModProps_skpValues, in_NameAttr, AttrValue)) //
then return(AttrValue)
else return("")
} // end fModProps_GetValue()
//-------------------------------------------------------------------
Date fModProps_GetValue(string in_NameModFull, string in_NameAttr)
{ // Overloaded, presume the value represents a Date
return(fDateOf(fModProps_GetValue(in_NameModFull, in_NameAttr)))
} // end Date fModProps_GetValue()
void DoTest(string in_NameModFull)
{
Date LastModOn = fModProps_GetValue(in_NameModFull, "Last Modified On")
string LastModBy = fModProps_GetValue(in_NameModFull, "Last Modified By")
print in_NameModFull "\t" LastModOn " \t" LastModBy "\n"
}
// Select a couple modules in the DOORS Explorer:
Skip skpSelected = getSelectedItems()
Item itm
for itm in skpSelected do
{ DoTest(fullName(itm))
}
delete(skpSelected)
Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: GetModProps issues Mathias Mamsch - Sat Jan 12 15:44:31 EST 2013
Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
I don't see how that would work, but then I don't see how any of this "voodoo" really works. On another topic, I see that my noError/lastError pair does NOT trap "no access to read attr" DXL errors. I thus had to add a "if (canReadVal(ad)).." check. -Louie |
Re: GetModProps issues llandale - Mon Jan 14 10:47:42 EST 2013
I don't see how that would work, but then I don't see how any of this "voodoo" really works. On another topic, I see that my noError/lastError pair does NOT trap "no access to read attr" DXL errors. I thus had to add a "if (canReadVal(ad)).." check. -Louie Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |